<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="css/index.css" />
    <style>
      .wz2 {
        width: 50%;
        margin-left: -10px;
        margin-top: 6px;
      }
    </style>
    
 
  </head>
  <body>

    <div class="box">
      <div class="top">
        <img src="./img/3.png" alt="" />
      </div>
      <div class="bottom  ">
        <img src="./img/4.png" alt="" />

        <div class="wz  wz2">
          <div id="textshow"  class="title"></div>
          <div id="contentshow"  class="content"></div>

          <div style="display: none" id="text">TO: 真是拿：</div>
          <div style="display: none"  id="content">
            1收到货发2真的很舒服if是分类课时费螺蛳粉劳动纪律康师傅的
          </div>
        </div>
      </div>
    </div>

    

    <script>
      function lunbo(params, callback) {
        var interval = 200;
        var timer = null;
        var index = 0;
        var word = document.querySelector(params.id).innerHTML.trim();

        function type() {
          var len = word.length;
          if (index > len ) {
            clearInterval(timer);

            callback && callback();

            return;
          }
          document.querySelector(params.areaid).innerText = word.substring(
            0,
            index++
          );
        }
        timer = setInterval(type, interval);
      }


     //   渲染内容
      lunbo(
        {
          //    要渲染元素的id
          id: "#text",
          //   要渲染区域 的id
          areaid: "#textshow",
        },
        function () {
          lunbo({
            //    要渲染元素的id
            id: "#content",
            //   要渲染区域 的id
            areaid: "#contentshow",
          });
        }
      );
      //   lunbo('#text')
    </script>

    
  </body>
</html>
